<?php
require_once './include/common.inc.php';
require_once AK_ROOT.'include/global.func.php';
$db = db();
monitor('start');
$start = 263456;
for($i = $start; $i < $start + 10; $i ++) {
	$sql = "SELECT * FROM ak_items WHERE category<1000 ORDER BY id DESC LIMIT {$i}, 10";
	$db->query($sql);
	monitor($i);
}
monitor_log();
for($i = $start; $i < $start + 10; $i ++) {
	$sql = "SELECT id FROM ak_items WHERE category<1000 ORDER BY id DESC LIMIT {$i}, 10";
	$query = $db->query($sql);
	$ids = array();
	while($item = $db->fetch_array($query)) {
		$ids[] = $item['id'];
	}
	if(!empty($ids)) {
		$ids = implode(',', $ids);
		$db->query("SELECT * FROM ak_items WHERE id IN ($ids) ORDER BY id DESC");
	}
	monitor($i);
}
monitor_log();
?>